//泛型
//函数
function swap<T,U>(arr:[T,U]):[U,T]{
    return [arr[1],arr[0]]
}
swap([1,2]);
swap<string,string>(['hello','a'])
let res=swap([1,'a']);
function createArr<T>(val:T,num:number):T[]{
    return new Array(num).fill(val)
}
let res2=createArr(false,20);
//接口
class bound{
    id:number
}
interface Res<T extends bound>{
    msg:string
    code:number
    data?:T[]
}
interface bannerData{
    id:number
    url:string
}
interface userData{
    id:number
    username:string
}
//发送了一个请求
let resData:Res<bannerData>={
    msg:'success',
    code:200,
    data:[
        {
        id:134568,
        url:"/sdjha/nsad",
        },
        {
        id:134568,
        url:"/sdjha/nsad",
        }
    ]
};
//resData.data[0].id
//类
class Human<T=number>{
    foo:T
}
let a=new Human<string>();
let b=new Human();
